﻿using System.Windows;
using AdTech.Common;

namespace AdTech.Snap
{
    /// <summary>
    /// Defines a set of extension methods.
    /// </summary>
    public static class Extensions
    {
        internal static string GetMIMEType(this QRCodeFormat format)
        {
            return format.GetDescription();
        }

        /// <summary>
        /// Whereas the meaning of "IsEmpty" seems questionable this is my interpretation.
        /// The Rect.IsEmpty property is equivalent to the Size.IsEmpty property and is only empty if the width is below 0.
        /// In my opinion a rectangle is empty if both width and height are zero..
        /// </summary>
        /// <param name="rectangle">The target rectangle.</param>
        /// <returns>Returns true if the size of the rectangle is zero.</returns>
        public static bool IsEmptyOrZero(this Rect rectangle)
        {
            return rectangle.IsEmpty || (rectangle.Width == 0 && rectangle.Height == 0);
        }
    }
}
